
package com.j2eefast.produce.pms.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.j2eefast.common.core.page.Query;
import com.j2eefast.common.core.utils.PageUtil;
import com.j2eefast.framework.utils.Constant;
import com.j2eefast.framework.utils.UserUtils;
import com.j2eefast.produce.pms.entity.PmsEntrustListEntity;
import com.j2eefast.produce.pms.entity.PmsReviewEntity;
import com.j2eefast.produce.pms.mapper.PmsEntrustListMapper;
import com.j2eefast.produce.pms.mapper.PmsReviewMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;

/**
 * <p>委托单数据列表</p>
 *
 * @author: summer
 * @date: 2021-05-28 16:47
 * @web: http://www.letukeji.cn
 * @version: 1.0.1
 */
@Service
@Transactional(readOnly = true)
public class PmsEntrustListService extends ServiceImpl<PmsEntrustListMapper, PmsEntrustListEntity> {

	@Resource
	protected PmsEntrustListMapper pmsEntrustListMapper;


	/**
	 * 页面展示查询翻页
	 */
	public PageUtil findPage(Map<String, Object> params) {
//		String sampleCode = (String) params.get("sampleCode");
//		String sampleType = (String) params.get("sampleType");


		Page<PmsEntrustListEntity> page = pmsEntrustListMapper.findPage(
				new Query<PmsEntrustListEntity>(params).getPage(),
//				StrUtil.nullToDefault(sampleCode,""),
//				StrUtil.nullToDefault(sampleType,""),
				(String) params.get(Constant.SQL_FILTER));
		return new PageUtil(page);
	}
	@Transactional(rollbackFor = Exception.class)
	public boolean deleteByIds(Long[] ids) {


		return pmsEntrustListMapper.deleteByIds(ids);

	}

	@Transactional(rollbackFor = Exception.class)

 	public boolean saves(PmsEntrustListEntity pmsEntrustListEntity){
		String  userName= UserUtils.getUserInfo().getName();
		Date date=new Date();
		pmsEntrustListEntity.setUpdateTime(date);
		pmsEntrustListEntity.setCreateTime(date);
		pmsEntrustListEntity.setCreateBy(userName);
		pmsEntrustListEntity.setUpdateBy(userName);
		return this.save(pmsEntrustListEntity);
	}




}
